<?php
define("UNDERKLEO", true);
require_once '../../../../conf/kleoconfig.php';
?>
<script type="text/javascript" src="../../../../js/prototype.js"></script>
<?php
  if($_POST['type'] == 'values'){
    $original = substr($_POST['editorId'], 18);
  } else if($_POST['type'] == 'names'){
    $original = substr($_POST['editorId'], 17);
  } else {
    die();
  }
  $new_values = str_replace($original, $_POST['value'], $_POST['all_values']);    
?>

<?php
  echo $_POST['value'];
?>

<script>
  $('list_custom_field_<?=$_POST['type'];?>').value = "<?=$new_values;?>";
</script>